import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { HttpExceptionFilter } from './common/filters/http-exception.filter';
import { LoggingInterceptor } from './common/interceptors/logging.interceptor';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  
  // 启用 CORS
  app.enableCors({
    origin: '*',
  });

  // 注册全局异常过滤器
  app.useGlobalFilters(new HttpExceptionFilter());
  
  // 注册全局日志拦截器
  app.useGlobalInterceptors(new LoggingInterceptor());

  await app.listen(3001);
}
bootstrap();
